const { data } = require("../../utils/logger");
const db = require('../../utils/mysql');

module.exports = async (ctx) => {
    const body = ctx.request.body;
    try {
        const results = await db.query('SELECT * FROM vidoe where vidoeID = "'+body.id+'"'); // 确保表名正确
        results.forEach(item => {
            item.vidoeUrl = JSON.parse(item.vidoeUrl);
            item.vidoetype = JSON.parse(item.vidoetype);
            item.vspan = JSON.parse(item.vspan);
        });
        ctx.body = JSON.stringify({
            code: 0,
            msg: `获取数据成功`,
            data:results
        });
    } catch (err) {
        ctx.status = 500; // 设置 HTTP 状态码为 500，表示服务器内部错误
        ctx.body = {code:500,message: '没有数据'};
    }
    
}